package cn.stylefeng.guns.unitl;

import java.io.File;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

public class ToolUtils {



    public static String getUUID(){
        return UUID.randomUUID().toString().replace("-","").trim();
    }

    public static boolean checkParam(Map<String, Object> map, String... strings){
        for (String str : strings) {
            if (map.get(str)==null) return false;
        }
        return true;
    }

    public static String errorMessage(Map<String,Object> map,String... strings){
        Set<String> notContainParam = new HashSet<String>();
        for (String str : strings) {
            if (map.get(str)==null) notContainParam.add(str);
        }
        return null;
    }

    public static String getTempImgUrl(){
        String os = System.getProperty("os.name");
        String url = null;
        if(os.toLowerCase().startsWith("win")){
            url = "C:\\temp\\";
            File file = new File(url);
            if (!file.exists()){
                file.mkdir();
            }
        } else{
            url = "/tmp/shop";
        }

        return url;
    }






}
